package com.hut.oa.model.bean;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * 公告通知表
 * @author 熊涛
 *
 */
@Entity
@Table(name="announce_")
public class Announce {
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="ann_id",nullable=false)		
	private Long id;//公告通知表id
	
	@Column(name="ann_type",nullable=false)
	private Integer type;//类型id
	
	@Column(name="ann_status",nullable=false)
	private Integer status=0;//状态id
	
	@Column(name="ann_start_time")
	private Date time=new Date();//发布时间
	
	@Column(name="ann_title",nullable=false)
	private String title;//标题
	
	@Column(name="ann_content")
	private String content;//内容
	
	@Column(name="ann_link")
	private String link;//链接地址
	
	@JoinColumn(name="ann_user_id")
	@ManyToOne
	private User user;//发送方id
	
	@Column(name="ann_is_delete")
	private Integer isDelete=0;//是否放入回收站
	
	@OneToMany(cascade=CascadeType.ALL,mappedBy="announce")
	private List<AnnounceUser> announceUsers;//通知人
	
	public Announce() {}
	
	public Announce(Integer type, Integer status, String title, String content, User user) {
		super();
		this.type = type;
		this.status = status;
		this.title = title;
		this.content = content;
		this.user = user;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getLink() {
		return link;
	}

	public void setLink(String link) {
		this.link = link;
	}

	public Integer getIsDelete() {
		return isDelete;
	}

	public void setIsDelete(Integer isDelete) {
		this.isDelete = isDelete;
	}

	public Integer getType() {
		return type;
	}


	public void setType(Integer type) {
		this.type = type;
	}


	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	public List<AnnounceUser> getAnnounceUsers() {
		return announceUsers;
	}

	public void setAnnounceUsers(List<AnnounceUser> announceUsers) {
		this.announceUsers = announceUsers;
	}

	@Override
	public String toString() {
		return "Announce [id=" + id + ", type=" + type + ", status=" + status + ", time=" + time + ", title=" + title
				+ ", content=" + content + ", link=" + link + ", isDelete=" + isDelete + "]";
	}
}
